n = int(input())
a = list(map(int, input().split()))
for i in range(n - 1):
    a[i] -= 1
p = 0
cnt = 0
while p <= n - 2:
    next_position = p
    further_position = p
    for j in range(p + 1, a[p] + 1):
        if j >= n - 1:
            next_position = n - 1
            break
        if further_position <= a[j]:
            next_position = j
            further_position = a[j]
    p = next_position
    cnt += 1
print(cnt)
